package com.diandi.ddsb.bean;

/**
 * 
 * 投资活动投资金额判断类型
 * 
 * @author liuxu
 * @since 2017年1月12日
 *
 */
public enum InvestAmountCheckType {
	ACCORDING_INVEST_SCOPE(1, "按投资区间"), ACCORDING_INVEST_AMOUNT(2, "按满投金额");

	/**
	 * value
	 */
	private final String text;
	/**
	 * key
	 */
	private final int value;

	InvestAmountCheckType(int value, String text) {
		this.value = value;
		this.text = text;
	}

	public static InvestAmountCheckType getTextByValue(int value) {
		for (InvestAmountCheckType item : InvestAmountCheckType.values()) {
			if (item.getValue() == value) {
				return item;
			}
		}
		throw new RuntimeException(value + "不是合法的类型！");
	}

	public static InvestAmountCheckType getValueByText(String text) {
		for (InvestAmountCheckType item : InvestAmountCheckType.values()) {
			if (item.getText() == text) {
				return item;
			}
		}
		throw new RuntimeException(text + "不是合法的类型！");
	}

	public String getText() {
		return text;
	}

	public int getValue() {
		return value;
	}
}
